﻿{% extends "simpleblog/base.html" %}
{% block sbcontent %}
    {% for obj in article_qs %}
        <div class="contentBlock">
        <div class="span2">
            {% if obj.img %}
                <img src="{{ obj.img.url }}">
            {% endif %}
        </div>
        <div class="blockDate">
            <div class="date">{{ obj.created_at|date:"d" }}</div>
            <div class="month">{{ obj.created_at|date:"M" }}</div>
        </div>
        <h2>{{ obj.title }}</h2>
        <p>{{ obj.description|linebreaksbr }}</p>
        <div style="font-weight:bold;">
            {% if obj.tags.all %}
                {% for tag in obj.tags.all %}
                    <a href="{% url "simpleblog.tag" tag.url_key %}">{{ tag.name }}</a>&nbsp;
                {% endfor %} |
            {% endif %}
            <a href="{% url "simpleblog.article" obj.url_key %}#comments"
               style="font-weight:normal;">{{ obj.get_comments.count }} comments</a>
            {% if user.is_authenticated %}
                | <a href="/admin/simpleblog/article/{{ obj.pk }}/" target="blank" style="font-weight:normal">edit</a>
            {% endif %}

            <p style="text-align:right;"><a href="{% url "simpleblog.article" obj.url_key %}" class="btn">Read more</a>
            </p>
        </div>
    {% endfor %}
    <div class="pagination">
        <ul>
            {% for page in pagination %}
                <li {% if page == actual_page %}class="active"{% endif %}><a
                        href="?page={{ page }}&limit={{ limit }}">{{ page }}</a></li>
            {% endfor %}
        </ul>
    </div>
{% endblock sbcontent %}
</div>